#ifndef FILEREADANDWRITETEST1_H
#define FILEREADANDWRITETEST1_H

#include<string>
#include<fstream>
#include<iostream>

namespace com{
    namespace example{
        namespace testone{
            namespace io{
                namespace file{


class FileReadAndWriteTest1
{
    public:
        FileReadAndWriteTest1();
        virtual ~FileReadAndWriteTest1();

    public:
        void test();
        void writeTextTest1();
        void readTextTest1();
        void writeBinaryTest1();
        void readBinaryTest1();
        void writeBinaryTest2();
        void readBinaryTest2();
        bool isExist(const std::string& fileName);
        bool deleteFile(const std::string& fileName);

    public:
        template<typename T>
        void readBinary(std::ifstream& fis, T* t){
            fis.read(reinterpret_cast<char*>(t), sizeof(T));
        }

        template<typename T>
        void writeBinary(std::ofstream& fos, T* t){
            fos.write(reinterpret_cast<char*>(t), sizeof(T));
        }


    protected:

    private:
        struct A{
            int x;
            double y;
            float z;
            char m;
            short n;
        };
};


                }
            }
        }
    }
}

#endif // FILEREADANDWRITETEST1_H
